﻿<Window x:Class="Simple_ToDo.Desktop.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
        Title="Simple To-Do" Height="528" Width="285" Name="MyWindow" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" Closing="MyWindow_Closing" MinWidth="285" MinHeight="400"  KeyDown="MyWindow_KeyDown" SizeChanged="MyWindow_SizeChanged" Icon="file:///D:/work/sources/Simple%20ToDo/Simple%20ToDo/Resources/check.ico">

    <Grid Name="myGrid">
        <ComboBox Name="listCategories" VerticalAlignment="Top" ItemsSource="{Binding}" SelectionChanged="ChangeCategorySelection" IsTabStop="False" Height="33" FontSize="15"></ComboBox>
        <TextBox Margin="0,0,51,0" Name="txtTask" TabIndex="0" VerticalAlignment="Bottom" AutoWordSelection="False" TextChanged="textChangedEventHandler" ToolTip="task   !project   \&quot;note   №priority (0,1,2,3)   ;Start Date   %End Date" Height="26" FontSize="14" AcceptsReturn="False">
            <TextBox.ContextMenu>
                <ContextMenu Name="contextMenu"/>
            </TextBox.ContextMenu>
        </TextBox>
        <Button Content="Add" Name="btnAddTask" IsDefault="True" Click="AddRecord" HorizontalAlignment="Right" Width ="50" VerticalAlignment="Bottom" IsTabStop="False" Height="26" />

        <DataGrid Name="listTasks"              
                  IsTabStop="True"
                  AutoGenerateColumns="False"   
                  Margin="0,32,0,26" 
                  KeyDown="listKeyDown"
                  SelectionMode="Single"
                  RowDetailsVisibilityMode="VisibleWhenSelected"
                  GridLinesVisibility="Horizontal" 
                  HorizontalGridLinesBrush="#24000000" 
                  LoadingRowDetails="listTasks_LoadingRowDetails"
                  IsReadOnly="True" 
                  RowHeight="37" 
                  HeadersVisibility="Column">
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <Grid>
                        <TextBox  Name="txtContent"   Height="23" HorizontalAlignment="Left" Margin="65,5,0,0"  VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="11" />
                        <ComboBox Name="cboxProject"  Height="23" HorizontalAlignment="Left" Margin="65,28,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="11" IsEditable="True" />
                        <ComboBox Name="cboxPriority" Height="23" HorizontalAlignment="Left" Margin="65,51,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="11" />
                        <ComboBox Name="cboxCategory" Height="23" HorizontalAlignment="Left" Margin="65,74,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="11" />
                        <TextBox  Name="txtNote"      Height="23" HorizontalAlignment="Left" Margin="65,97,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="11" />
                        <extToolkit:DateTimePicker Name="dtpStartDate" Height="23" HorizontalAlignment="Left" Margin="65,120,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="10" />
                        <extToolkit:DateTimePicker Name="dtpEndDate"   Height="23" HorizontalAlignment="Left" Margin="65,143,0,0" VerticalAlignment="Top" Width="180" BorderThickness="1" FontSize="10" />
                        <Button Name="btnSaveChanges" Content="Save" Height="23" Width="180" Margin="65,166,0,5" HorizontalAlignment="Left" VerticalAlignment="Top" Click="btnSaveChanges_Click"/>

                        <TextBlock Text="Task"       Margin="10,5,0,0"    Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="Project"    Margin="10,28,0,0"   Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="Priority"   Margin="10,51,0,0"   Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="Category"   Margin="10,74,0,0"   Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="Note"       Margin="10,97,0,0"   Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="Start date" Margin="10,120,0,0"  Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                        <TextBlock Text="End date"   Margin="10,143,0,0"  Height="20" Width="50" Padding="0,2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
                    </Grid>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
            
            <DataGrid.Columns>
                <DataGridTemplateColumn CanUserResize="False" CanUserReorder="False" Width="20">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="listTasksCheckBox" Checked="listTasksCheckBox_Checked" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="Content" Width="117" x:Name="listTasksColumnContent">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="Wrap" Text="{Binding Path=Content}" FontSize="13"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="Project" Width="75" x:Name="listTasksColumnProject">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock TextWrapping="Wrap" Text="{Binding Path=Project}" FontSize="13"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTextColumn x:Name="listTasksColumnPriority" Header="Priority" Binding="{Binding Path=Priority}" FontSize="13" Width="55" CanUserResize="False" />
            </DataGrid.Columns>
        </DataGrid>

        <DataGrid Name="listProjects" 
                  IsTabStop="True"
                  Margin="0,32,0,26"
                  Visibility="Collapsed"
                  KeyDown="listKeyDown"
                  AutoGenerateColumns="False"
                  IsReadOnly="True" 
                  Width="{Binding ElementName=MyWindow, Path=ActualWidth}"
                  Height="{Binding ElementName=MyWindow, Path=ActualHeigth}"
                  RowHeight="25" 
                  HeadersVisibility="Column"
                  >
            <DataGrid.Columns>
                <DataGridTemplateColumn CanUserResize="False" CanUserReorder="False">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox Name="listProjectsCheckBox" Checked="listProjectsCheckBox_Checked"></CheckBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn x:Name="listProjectsColumn" Header="Project" Binding="{Binding}"/>
            </DataGrid.Columns>
        </DataGrid>

        <DataGrid Name="listNotes" 
                  IsTabStop="True"
                  Margin="0,32,0,26" 
                  Visibility="Collapsed"
                  KeyDown="listKeyDown"
                  AutoGenerateColumns="False" 
                  IsReadOnly="True"
                  Width="{Binding ElementName=MyWindow, Path=ActualWidth}"
                  Height="{Binding ElementName=MyWindow, Path=ActualHeigth}"
                  RowHeight="25" 
                  HeadersVisibility="Column"
                  >
            <DataGrid.Columns>
                <DataGridTemplateColumn CanUserResize="False" CanUserReorder="False">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox Name="listNotesCheckBox" Checked="listNotesCheckBox_Checked"></CheckBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn x:Name="listNotesColumn" Header="Note" Binding="{Binding}"/>
            </DataGrid.Columns>
        </DataGrid>
        <extToolkit:DateTimePicker Margin="0,0,51,26" Name="calendar1" VerticalAlignment="Bottom" Visibility="Hidden"/>
        <Button Content="Ok" Margin="0,0,0,26" Name="btnCalendar" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="50" IsTabStop="False" Visibility="Hidden" Click="btnCalendar_Click"/>
    </Grid>
</Window>
